<template>
	<view class="container">
		<view class="item _top20" hover-class="active-bg" @tap="openCall">
      <tui-icon name="kefu"></tui-icon>
			<text class="txt">电话客服</text>
		</view>
		<!-- #ifdef MP-WEIXIN || MP-TOUTIAO -->
		<button open-type="contact" class="item mybtn _top20" hover-class="active-bg">
      <tui-icon name="wechat"></tui-icon>
			<text class="txt">在线客服</text>
		</button>
		<!-- #endif -->
    <!-- #ifdef MP-ALIPAY -->
    <button class="item mybtn _top20" hover-class="active-bg">
      <contact-button tnt-inst-id="ZOp_4PlE" scene="SCE01197936" color="#999" icon="../../../static/images/mall/mine_def_touxiang_3x.png"/>
      <text class="txt">在线客服</text>
    </button>
    <!-- #endif -->
	</view>
</template>

<script>
  const util = require("@/utils/util.js")
	export default {
		data() {
			return {
				phone: '15209831990'
			}
		},
    onLoad(){
      let that = this;
      util.request('index/getTreaty', {
        type: 3
      }).then(function(res) {
        if (res.code === 0) {
          that.phone = res.data
        }
      });
    },
		methods: {
			openCall: function() {
				uni.makePhoneCall({
					phoneNumber: this.phone
				})
			}
		}
	}
</script>

<style>
	page {
		height: 100%;
		width: 100%;
		background: #f4f4f4;
	}

	.container {
		background: #f4f4f4;
		height: auto;
		overflow: hidden;
		width: 100%;
	}

	.container button {
		width: 100%;
    height: 100rpx;
	}

	.item {
		background-color: #fff;
		color: #000;
		display: flex;
		align-items: center;
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-top: 15rpx;
		padding-bottom: 15rpx;
	}

	.mybtn::after {
		border-radius: 0;
		border: 0;
	}

	.mybtn {
		border-radius: 0;
		border: 0;
	}

	.item .txt {
		margin-left: 30rpx;
		font-size: 30rpx;
	}

	._top20 {
		margin-top: 20rpx;
	}
</style>
